const Mock = require('mockjs')
module.exports = [
    {
        url: '/home/logo',
        type: 'get',
        response: _ => {
            return {
                code: 200,
                data: Mock.Random.image('170x40', Mock.Random.hex(), Mock.Random.hex(), 'png', '商城')
            }
        }
    },
    {
        url: '/home/banner',
        type: 'get',
        response: _ => {
            let data = [];
            for (let i = 0; i < 4; i++) {
                data[i] = Mock.mock({
                    'bid|+1': Mock.Random.increment(),
                    'src': Mock.Random.dataImage('1000x400', '1000x400')
                })
            }
            return {
                code: 200,
                data: data
            }
        }
    },
    {
        url: '/home/fs',
        type: 'get',
        response: _ => {
            let data = [];
            for (let i = 0; i < 6; i++) {
                data[i] = Mock.mock({
                    'pid|+1': Mock.Random.increment(),
                    'title': Mock.Random.ctitle(9, 10),
                    'details': Mock.Random.csentence(28, 34),
                    'price|4000-10000.2': 1,
                    'href': Mock.Random.url('http'),
                })
            }
            data[0].img = Mock.Random.image('390x300', Mock.Random.hex());
            data[1].img = Mock.Random.image('260x280', Mock.Random.hex());
            data[2].img = Mock.Random.image('180x200', Mock.Random.hex());
            data[3].img = Mock.Random.image('190x140', Mock.Random.hex());
            data[4].img = Mock.Random.image('190x140', Mock.Random.hex());
            data[5].img = Mock.Random.image('190x140', Mock.Random.hex());
            return {
                code: 200,
                data: data
            }
        }
    },
    {
        url: '/home/trait',
        type: 'get',
        response: _ => {
            let data = [];
            for (let i = 0; i < 4; i++) {
                data[i] = Mock.mock({
                    'img': Mock.Random.image('80x80', Mock.Random.hex()),
                    'title': Mock.Random.ctitle(4)
                })
            }
            return {
                code: 200,
                data: data
            }
        }
    },
]
